#include "stdafx.h"
#include "State.h"
#include "Marco.h"

State::State() : m_ListEntities(NULL), m_NumEntities(0)
{
	
}


State::~State()
{
	for (int i = 0; i < m_NumEntities; i++)
		Delete(m_ListEntities[i]);
	Delete_Array(m_ListEntities);
}

void State::Key(ESContext *esContext, unsigned char key, bool bIsPressed)
{

}

void State::Update(ESContext* esContext, float deltatime)
{
	for (int i = 0; i < m_NumEntities; i++)
	{
		if (m_ListEntities[i])
		{
			m_ListEntities[i]->update(deltatime);
		}
	}
}

void State::Draw(ESContext* esContext)
{
	for (int i = 0; i < m_NumEntities; i++)
	{
		if (m_ListEntities[i])
		{
			m_ListEntities[i]->draw();
			//m_ListEntities[i]->Draw();
		}
	}
}

void State::AddEntity(Entity* newEntity)
{
	if (count == m_NumEntities)
		return;
	m_ListEntities[count] = newEntity;
	count++;
}

